﻿/********
* 
* 
*  Description:
*  Create By kain.hong at 8/9/2010 3:22:13 PM
*  
*
*  Revision History:
*  Date                  Who                 What
*  
* 
*/
#region namespace

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.ServiceModel;

#endregion


namespace Cherry.Agile.ServiceModel.Interceptor
{
    /// <summary>
    /// 异常消息数据实体
    /// </summary>
    [DataContractAttribute(Name = "FaultMessage", Namespace = Unity.NAMESPACE)]
    public class FaultMessage : ExceptionDetail
    {
        public const string FaultSubCodeNamespace = Unity.NAMESPACE + "/exceptionhandling/";
        public const string FaultSubCodeName = "ServiceError";
        public const string FaultAction = Unity.NAMESPACE + "/fault";

        [DataMember]
        public string AssemblyQualifiedName
        { get; private set; }

        [DataMember]
        public new FaultMessage InnerException
        { get; private set; }

        
        public FaultMessage(Exception ex)
            : base(ex)
        {
            this.AssemblyQualifiedName = ex.GetType().AssemblyQualifiedName;
            if (null != ex.InnerException)
            {
                this.InnerException = new FaultMessage(ex.InnerException);
            }
            
        }

        public override string ToString()
        {
            return this.Message;
        }
    }
}

